package com.ecnu.sei.app.course;

import com.ecnu.sei.app.resources.Time;
import com.ecnu.sei.app.teacher.Official;
import com.ecnu.sei.app.util.Pair;
import com.ecnu.sei.app.util.Utils;
import com.ecnu.sei.app.util.Utils.DayHour;


/*
 *  SpecialtyElective course rules:
 *  
 *  1. at the same DayHour and Classroom as that of CourseInfo
 *  2. Elective course exams and Compulsory course exams take place in different weeks
 *     so that there should be no collision between them
 */

public class SpecialtyElective extends AbstractCourse {

  
  public SpecialtyElective(CourseInfo info) {
    super(info);
  }
  
  @Override
  public boolean setResource() {
    ExamInfo examInfo = info.getExamInfo();
    Pair<Integer, DayHour> courseTime = info.getCourseTimeList().get(0);
    Time time = new Time(scheduler.getElectiveStartTime());
    time.addDays(courseTime.getFirst());
    time.setDayHour(courseTime.getSecond());
    
    examInfo.setTime(time)
            .setClassroom(info.getClassroom())
            .setProctorNum(info.getStudentNum() >= 60 ? 3 : 2);
    return true;
  }

  @Override
  public boolean setResourcePending() {
    return true;
  }

  @Override
  public boolean setPatrol(Official official) {
    // do nothing here
    return true;
  }
}
